3.113 \(\int \sin ^2(a+\frac{b}{x}) \, dx\)

Optimal. Leaf size=41 \[ -b \sin (2 a) \text{CosIntegral}\left (\frac{2 b}{x}\right )-b \cos (2 a) \text{Si}\left (\frac{2 b}{x}\right )+x \sin ^2\left (a+\frac{b}{x}\right ) \]

[Out]

-(b*CosIntegral[(2*b)/x]*Sin[2*a]) + x*Sin[a + b/x]^2 - b*Cos[2*a]*SinIntegral[(2*b)/x]

________________________________________________________________________________________

Rubi [A]  time = 0.0905833, antiderivative size = 41, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 6, integrand size = 10, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.6, Rules used = {3361, 3313, 12, 3303, 3299, 3302} \[ -b \sin (2 a) \text{CosIntegral}\left (\frac{2 b}{x}\right )-b \cos (2 a) \text{Si}\left (\frac{2 b}{x}\right )+x \sin ^2\left (a+\frac{b}{x}\right ) \]

Antiderivative was successfully verified.

[In]

Int[Sin[a + b/x]^2,x]

[Out]

-(b*CosIntegral[(2*b)/x]*Sin[2*a]) + x*Sin[a + b/x]^2 - b*Cos[2*a]*SinIntegral[(2*b)/x]

Rule 3361

Int[((a_.) + (b_.)*Sin[(c_.) + (d_.)*((e_.) + (f_.)*(x_))^(n_)])^(p_.), x_Symbol] :> Dist[1/(n*f), Subst[Int[x
^(1/n - 1)*(a + b*Sin[c + d*x])^p, x], x, (e + f*x)^n], x] /; FreeQ[{a, b, c, d, e, f}, x] && IGtQ[p, 0] && In
tegerQ[1/n]

Rule 3313

Int[((c_.) + (d_.)*(x_))^(m_)*sin[(e_.) + (f_.)*(x_)]^(n_), x_Symbol] :> Simp[((c + d*x)^(m + 1)*Sin[e + f*x]^
n)/(d*(m + 1)), x] - Dist[(f*n)/(d*(m + 1)), Int[ExpandTrigReduce[(c + d*x)^(m + 1), Cos[e + f*x]*Sin[e + f*x]
^(n - 1), x], x], x] /; FreeQ[{c, d, e, f, m}, x] && IGtQ[n, 1] && GeQ[m, -2] && LtQ[m, -1]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 3303

Int[sin[(e_.) + (f_.)*(x_)]/((c_.) + (d_.)*(x_)), x_Symbol] :> Dist[Cos[(d*e - c*f)/d], Int[Sin[(c*f)/d + f*x]
/(c + d*x), x], x] + Dist[Sin[(d*e - c*f)/d], Int[Cos[(c*f)/d + f*x]/(c + d*x), x], x] /; FreeQ[{c, d, e, f},
x] && NeQ[d*e - c*f, 0]

Rule 3299

Int[sin[(e_.) + (f_.)*(x_)]/((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[SinIntegral[e + f*x]/d, x] /; FreeQ[{c, d,
 e, f}, x] && EqQ[d*e - c*f, 0]

Rule 3302

Int[sin[(e_.) + (f_.)*(x_)]/((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[CosIntegral[e - Pi/2 + f*x]/d, x] /; FreeQ
[{c, d, e, f}, x] && EqQ[d*(e - Pi/2) - c*f, 0]

Rubi steps

\begin{align*} \int \sin ^2\left (a+\frac{b}{x}\right ) \, dx &=-\operatorname{Subst}\left (\int \frac{\sin ^2(a+b x)}{x^2} \, dx,x,\frac{1}{x}\right )\\ &=x \sin ^2\left (a+\frac{b}{x}\right )-(2 b) \operatorname{Subst}\left (\int \frac{\sin (2 a+2 b x)}{2 x} \, dx,x,\frac{1}{x}\right )\\ &=x \sin ^2\left (a+\frac{b}{x}\right )-b \operatorname{Subst}\left (\int \frac{\sin (2 a+2 b x)}{x} \, dx,x,\frac{1}{x}\right )\\ &=x \sin ^2\left (a+\frac{b}{x}\right )-(b \cos (2 a)) \operatorname{Subst}\left (\int \frac{\sin (2 b x)}{x} \, dx,x,\frac{1}{x}\right )-(b \sin (2 a)) \operatorname{Subst}\left (\int \frac{\cos (2 b x)}{x} \, dx,x,\frac{1}{x}\right )\\ &=-b \text{Ci}\left (\frac{2 b}{x}\right ) \sin (2 a)+x \sin ^2\left (a+\frac{b}{x}\right )-b \cos (2 a) \text{Si}\left (\frac{2 b}{x}\right )\\ \end{align*}

Mathematica [A]  time = 0.0913828, size = 41, normalized size = 1. \[ -b \sin (2 a) \text{CosIntegral}\left (\frac{2 b}{x}\right )-b \cos (2 a) \text{Si}\left (\frac{2 b}{x}\right )+x \sin ^2\left (a+\frac{b}{x}\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[Sin[a + b/x]^2,x]

[Out]

-(b*CosIntegral[(2*b)/x]*Sin[2*a]) + x*Sin[a + b/x]^2 - b*Cos[2*a]*SinIntegral[(2*b)/x]

________________________________________________________________________________________

Maple [A]  time = 0.014, size = 52, normalized size = 1.3 \begin{align*} -b \left ( -{\frac{x}{2\,b}}+{\frac{x}{2\,b}\cos \left ( 2\,a+2\,{\frac{b}{x}} \right ) }+{\it Si} \left ( 2\,{\frac{b}{x}} \right ) \cos \left ( 2\,a \right ) +{\it Ci} \left ( 2\,{\frac{b}{x}} \right ) \sin \left ( 2\,a \right ) \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(a+b/x)^2,x)

[Out]

-b*(-1/2*x/b+1/2*cos(2*a+2*b/x)*x/b+Si(2*b/x)*cos(2*a)+Ci(2*b/x)*sin(2*a))

________________________________________________________________________________________

Maxima [C]  time = 1.13638, size = 89, normalized size = 2.17 \begin{align*} -\frac{1}{2} \,{\left ({\left (-i \,{\rm Ei}\left (\frac{2 i \, b}{x}\right ) + i \,{\rm Ei}\left (-\frac{2 i \, b}{x}\right )\right )} \cos \left (2 \, a\right ) +{\left ({\rm Ei}\left (\frac{2 i \, b}{x}\right ) +{\rm Ei}\left (-\frac{2 i \, b}{x}\right )\right )} \sin \left (2 \, a\right )\right )} b - \frac{1}{2} \, x \cos \left (\frac{2 \,{\left (a x + b\right )}}{x}\right ) + \frac{1}{2} \, x \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(a+b/x)^2,x, algorithm="maxima")

[Out]

-1/2*((-I*Ei(2*I*b/x) + I*Ei(-2*I*b/x))*cos(2*a) + (Ei(2*I*b/x) + Ei(-2*I*b/x))*sin(2*a))*b - 1/2*x*cos(2*(a*x
 + b)/x) + 1/2*x

________________________________________________________________________________________

Fricas [A]  time = 1.45208, size = 167, normalized size = 4.07 \begin{align*} -x \cos \left (\frac{a x + b}{x}\right )^{2} - b \cos \left (2 \, a\right ) \operatorname{Si}\left (\frac{2 \, b}{x}\right ) - \frac{1}{2} \,{\left (b \operatorname{Ci}\left (\frac{2 \, b}{x}\right ) + b \operatorname{Ci}\left (-\frac{2 \, b}{x}\right )\right )} \sin \left (2 \, a\right ) + x \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(a+b/x)^2,x, algorithm="fricas")

[Out]

-x*cos((a*x + b)/x)^2 - b*cos(2*a)*sin_integral(2*b/x) - 1/2*(b*cos_integral(2*b/x) + b*cos_integral(-2*b/x))*
sin(2*a) + x

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \sin ^{2}{\left (a + \frac{b}{x} \right )}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(a+b/x)**2,x)

[Out]

Integral(sin(a + b/x)**2, x)

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \sin \left (a + \frac{b}{x}\right )^{2}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(a+b/x)^2,x, algorithm="giac")

[Out]

integrate(sin(a + b/x)^2, x)